package com.atgugui.ossservice.controller;


import com.atgugui.commonutils.Result;
import com.atgugui.ossservice.service.OssService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = "oss服务")
@RestController
@RequestMapping(value = "/eduoss/fileOss",method = RequestMethod.POST)
@CrossOrigin
public class OssController {
    @Autowired
    private OssService ossService;

    /**
     * OSS上传文件
     * @return
     */
    @CrossOrigin
    @ApiOperation(value = "oss文件上传接口")
    @PostMapping
    public Result upLoadOssAvatar(MultipartFile file) {
        String url = ossService.upLoadOssAvatar(file);
        return Result.ok().data("url",url);
    }
}
